from common.common import Common
from common.exchange.exchange2k8 import MailboxDatabase
from common.exchange.power_shell import ExchangeConsole
import os
"""
actually it's a hacky stuff
"""
            
class Exchange2010PowerShellSnapin(ExchangeConsole):
    header = 'add-pssnapin microsoft.exchange.management.powershell.e2010;'
    
class MailboxDatabase2010(MailboxDatabase):
    
    def __init__(self, name):
        MailboxDatabase.__init__(self, Exchange2010PowerShellSnapin(), name)
    
    def set_circular_logging(self, action = True):
        cmd = 'Set-MailboxDatabase -Identity \'{0}\' -CircularLoggingEnabled ${1}'.format(self.name, str(action).lower())
        self.common.log.debug('setting circular loggin: {0}'.format(action))
        self._run_ps_cmd(cmd, StorageGroupError)

        
    

